package com.cango.student;

import com.alibaba.fastjson.JSON;

import java.util.ArrayList;
import java.util.List;
import java.util.Optional;

/**
 * @program: student
 * @description:
 * @author: xie jiefeng
 * @create: 2019-06-28 15:02
 */
public class OptionTest {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();
        list.add("a");
        list.add("b");
        list.add("c");
        list.add("d");

        List<String> pretimeList = Optional.ofNullable(list).orElse(null);

        System.out.println(JSON.toJSONString(pretimeList));
        list = null;
        pretimeList = Optional.ofNullable(list).orElse(null);
        System.out.println(list);
    }
}
